Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: private aa mutation groups #1481

Merged
merged 8 commits into from
Jun 6, 2024

Conversation

ivan-aksamentov
Copy link
Member

In preparation for #1454

Among other things, in order to render private and relative aa mutations we need to group them similarly to how absolute aa mutations are grouped. This involves finding adjacent mutations and nuc context for these mutations.

Sadly, the code for grouping is quite complex and is not immediately reusable (it combines aa mutation search and grouping at the same time), so let's do some refactoring.

In preparation for #1454

Among other things, in order to render private and relative aa mutations we need to group them similarly to how absolute aa mutations are grouped. This involves finding adjacent mutations and nuc context for these mutations.

Sadly, the code for grouping is quite complex and is not immediately reusable (it combines aa mutation search and grouping at the same time), so let's do some refactoring.

Let's start from factoring away structs and functions that will be unchanged, to clear up some space for the action, to minimize diffs  and to reduce scrolling.
Rather than carrying the 2 vecs for qry and ref sequences, lets group them into a class with meaningful methods. This prevents position lookup code from spreading everywhere, and removes extra param to pass into functions.
Let's make the free functions checking for certain conditions at certain positions into class methods.

These functions are useful for all kinds of mutation structs, so let's move some into the `AbstractMutation` trait. Turns out that most of these functions can have neat default implementations just from existing trait methods.
Copy link

vercel bot commented Jun 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nextclade ✅ Ready (Inspect) Visit Preview Jun 6, 2024 10:10pm

@ivan-aksamentov ivan-aksamentov merged commit ba26a68 into master Jun 6, 2024
20 checks passed
@ivan-aksamentov ivan-aksamentov deleted the refactor/private-aa-mutation-groups branch June 6, 2024 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant